package com.nuoyun.tnvmue.adapter;

import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.nuoyun.tnvmue.R;

/**
 * @author jiangyao
 * Date: 2020/4/10
 * Email: jiangmr@vip.qq.com
 * TODO: 帮助列表适配器
 */
public class HelpAdapter extends BaseAdapter {

    Activity activity;

    public HelpAdapter(Activity activity) {
        this.activity = activity;
    }


    private String[] strings = {"有些刚更新的电视剧打开播放不了?", "安卓手机不能横屏?"};


    @Override
    public int getCount() {
        return strings.length;
    }

    @Override
    public String getItem(int i) {
        return strings[i];
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        MyView myView;
        if (view == null) {
            myView = new MyView();
            view = View.inflate(activity, R.layout.item_help, null);
            myView.text = view.findViewById(R.id.text);
            view.setTag(myView);
        } else {
            myView = (MyView) view.getTag();
        }

        myView.text.setText(getItem(i));

        return view;
    }

    static class MyView {
        TextView text;
    }
}
